package com.game.system.domain.game;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.game.common.annotation.Excel;
import com.game.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * 游戏账号对象 game_account
 *
 * @author Mr.Liu
 * @date 2025-03-18
 */
@Setter
@Getter
@TableName(resultMap = "com.game.system.mapper.GameAccountMapper.GameAccountResult")
public class GameAccount extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 游戏账号id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户id
     */
    @Excel(name = "用户id")
    private Long userId;
    /**
     * 游戏id
     */
    @Excel(name = "用户id")
    private Long gameId;

    /**
     * 代理id（账号归属谁管理）
     */
    @Excel(name = "代理id", readConverterExp = "账号归属谁管理")
    private Long agentId;

    /**
     * 模板id
     */
    @Excel(name = "模板id")
    private Long templateId;

    /**
     * 账号
     */
    @Excel(name = "账号")
    @NotBlank(message = "账号不能为空")
    private String account;

    /**
     * 密码
     */
    @Excel(name = "密码")
    @NotBlank(message = "密码不能为空")
    private String password;

    /**
     * 状态（待处理、处理中、冷却中、异常、停用）
     */
    @Excel(name = "状态", readConverterExp = "待处理、处理中、冷却中、异常、停用")
    private String status;

    /**
     * 删除标志（0代表存在 2代表删除）
     */
    private String delFlag;

    /**
     * 上号时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date nextTime;

    /**
     * 插队时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date jumpTime;
    /**
     * 过期时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date expiresTime;

    /**
     * 模板信息
     */
    private AccountTemplate accountTemplate;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("userId", getUserId())
                .append("agentId", getAgentId())
                .append("templateId", getTemplateId())
                .append("account", getAccount())
                .append("password", getPassword())
                .append("status", getStatus())
                .append("delFlag", getDelFlag())
                .append("createTime", getCreateTime())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }
}
